package com.hxexp.weixin.test;

import org.junit.Assert;
import org.junit.FixMethodOrder;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.MethodSorters;

import com.hxexp.weixin.common.security.AESHelper;
import com.hxexp.weixin.test.runner.JUnit4WithLogClassRunner;

@RunWith(JUnit4WithLogClassRunner.class)
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class AESHelperTester {

    @Test
    public void testCase01() {
        String pwd = "dGhpcyBpcyBhr5k7cyBhr5k7cyBhr5k7";
        String text = "11111111";

        byte[] b = AESHelper.encrypt(text, pwd);
        String retrunValue = AESHelper.decrypt(b, pwd);
        Assert.assertEquals(text, retrunValue);
    }

    @Test
    public void testCase02() {
        String pwd = "dGhpcyBpcyBhr5k7cyBhr5k7cyBhr5k7";
        String text = "22222222";

        String str = AESHelper.encryptString(text, pwd);
        String retrunValue = AESHelper.decryptString(str, pwd);
        Assert.assertEquals(text, retrunValue);
    }
}
